home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / emacs-18.59bin.lha / emacs-18.59 / amiga / amiga.doc < prev    next >
Encoding:
Text File  |  1995-01-14  |  21.2 KB  |  558 lines

  1. 1. Introduction
  2. ---------------
  3.  
  4. Emacs is a powerful, but sometimes cryptic, editor. In this Amiga
  5. version, I have tried to make it easier to use with menus, mouse
  6. support and arrow key support, but it still requires some getting used
  7. to. I would recommend starting with the tutorial, which can be started
  8. from the Help menu (if it is missing, you didn't install emacs
  9. correctly. Check that the file s:.emacs-menu.el exists) or from the
  10. keyboard by typing Control-H and then t.
  11.  
  12. This file only describes the Amiga specific features of emacs, and it
  13. assumes a working knowledge of emacs. For more documentation you can
  14. consult the emacs help (Information in the Help menu, or C-h i) or
  15. read the emacs manual (which is the same document in a printed form).
  16. This manual can be bought from the
  17.  
  18.      Free Software Foundation
  19.      675 Mass Ave
  20.      Cambridge, MA 02139
  21.      USA
  22.  
  23. See the file gnuemacs:etc/DISTRIB for more information (you can type
  24. C-h C-d to view it).
  25.  
  26. To install emacs, read the file INSTALLATION.
  27.  
  28.  
  29. 2. Changes since the last version
  30. ---------------------------------
  31.  
  32. Several features have been added since v1.26:
  33.  
  34. - based on emacs 18.59 instead of 18.58
  35. - changes contributed by Christian E. Hopps: new AREXX code, enhancements
  36. to the screen routines (more flexibility, read window & screen size,
  37. ...).
  38. - amiga-iconify is now a toggle (to allow deiconification from AREXX).
  39. - the infamous 'vfork: not enough memory' message is now more explicit :-)
  40. - miscellaneous bug fixes
  41.  
  42. 3. Using emacs in a window
  43. --------------------------
  44.  
  45. Emacs runs in a window on the Workbench (this can be changed). It
  46. basically works like just any other version of GNU Emacs, using the
  47. same keys, etc. It uses the standard amiga keymap, but with some strange
  48. modifications:
  49.  
  50. o The left alt key is stolen as a meta key for emacs. This means you can't use
  51. it to enter accents. However, the right alt key remains untouched. Hence
  52. 'left alt-f e' moves forward one word and inserts an e, while
  53. 'right alt-f e' inserts an e acute. In the rest of the text, the meta key
  54. always means the 'left alt' key.
  55.  
  56. o C-space is always mapped to C-@, the set-mark command, for convenience.
  57.  
  58. o The backspace key always sends DEL (delete previous character in emacs),
  59. and DEL sends C-d (delete character under cursor). If you don't like this, 
  60. add the line
  61.     (setq amiga-remap-bsdel nil)
  62. to your .emacs file (in s:).
  63.  
  64. o Keypad keys are prefixed with C-x C-^ K (so 0 generates C-x C-^ K 0).
  65. Normally, C-x C-^ K is a do-nothing operation, so the keypad keys just
  66. insert the usual character. If you want to redefine the keypad keys, you
  67. must do the following:
  68.  
  69.   (global-set-key "\C-x\C-^K" (make-sparse-keymap))
  70.   (global-set-key "\C-x\C-^K0" '<function for key 0>)
  71.   (global-set-key "\C-x\C-^K1" '<function for key 0>)
  72.   ...
  73.  
  74. Once you have redefined one key, you must define all of them (as C-x C-^ K
  75. is no longer a do-nothing command). If you still want a keypad to insert
  76. its usual character, you can use (for +)
  77.  
  78.   (global-set-key "\C-x\C-^K+" 'self-insert-command)
  79.  
  80. Even with this, the numeric keypad will not work with the incremental
  81. search function. The only way past that is to disable the C-x C-^ K
  82. prefix, with the following code:
  83.  
  84.   (setq amiga-remap-numeric-keypad nil)
  85.  
  86. (and you will then not be able to redefine the keypad keys).
  87.  
  88. o The sequences for function & arrow keys are the standard Amiga ones, 
  89. except that the initial character (CSI, code 155) is replaced by
  90. C-x C-^. For example, F1 is C-x C-^ 0 ~. You can always find the 
  91. characters generated by a key by pressing it, and then executing
  92. M-x view-lossage. This displays the last 100 characters seen by emacs. So
  93. to define F1 to be view-lossage you would add
  94.  
  95.   (global-set-key "\C-x\C-^0~" 'view-lossage)
  96.  
  97. to s:.emacs (trying to define F1 interactively with M-x global-set-key
  98. will fail ...).
  99.  
  100.  
  101. There are several extra features:
  102.  
  103. a) Mouse support, similar to the X-Windows version.
  104.  
  105. You can position the cursor with the left mouse button. Other possibilites are:
  106.  
  107. action            result
  108. ------------------------------
  109. shift-left button    set mark at mouse position
  110. control-left button    cut between point and mouse position
  111. meta-left button    copy between point and mouse position
  112. middle button        paste
  113. shift-middle button    iconify emacs window (double click to deiconify)
  114.  
  115. Some of the control, meta, etc combinations may be stolen by Intuition or
  116. commodities programs, so don't be surprised if they don't all work.
  117.  
  118. All of these actions may be redefined (this is emacs after all!), see the
  119. file lisp/amiga-mouse.el for details (you will need to learn lisp if you don't
  120. already know it ...) [Note: this file is not included in the binary only
  121. distribution, you will need the source code version].
  122.  
  123. b) Clipboard
  124.  
  125. At first glance, emacs uses the Amiga clipboard, ie it cuts to the
  126. clipboard and pastes from it (via the menu operations or the C-w
  127. (kill-region), M-w (copy-region-as-kill) & C-y (yank) commands).
  128.  
  129. Things are actually complicated by emacs use of a "kill ring" (ie it
  130. remembers the last 30 things cut. The M-y (yank-pop, menu command
  131. Paste Previous) allows you to recover old cuts):
  132.  
  133. - When you cut (or copy) something in emacs it is placed in the
  134. clipboard.
  135.  
  136. - When you paste (yank) something in emacs, it checks the clipboard to
  137. see if it contains anything new. If so, it pastes that.
  138.  
  139. [Note: It also checks the clipboard when you cut something, and saves
  140. that in the kill-ring if necessary]
  141.  
  142. All this effort is used to make the clipboard appear to operate
  143. transparently in emacs.
  144.  
  145. c) Window
  146.  
  147. By default, emacs runs in a window on the workbench screen using the
  148. system default font and the standard colours. All this can be changed:
  149.  
  150. o The font can be specified with the -fn <font> <size> option when you
  151. run emacs. You can also use the amiga-set-font command interactively,
  152. or add a line like
  153.    (amiga-set-font "topaz" 11)
  154. to your s:.emacs file. The font must be non-proportional.
  155.  
  156. o The window size and screen can be changed with the
  157. amiga-set-geometry function. It takes 4, 5 or 6 parameters, the (x,y)
  158. position of the window and its (width,height). The 5th optional
  159. parameter specifies the screen: a string gives the name of a public
  160. screen, t stands for the default public screen (normally the
  161. workbench) and nil means keep the same screen. Finally, if the 6th
  162. parameter is present and not nil, a backdrop window is used.
  163.  
  164. For example, the lisp code
  165.   (amiga-set-geometry 0 0 640 400)
  166. resizes the emacs window to 640x400. If the screen would be too small
  167. given the current font (there must be room for 11x4 characters), the
  168. change is refused.
  169.  
  170. Michael Kaiser has contributed a simple public screen creation
  171. utility: gnuemacs:amiga/contrib/kaiser/pub is a program that creates
  172. a public screen called "EmacsPublicScreen".
  173.  
  174. o The foreground & background colours can be changed with the 
  175. amiga-set-foreground-color & amiga-set-background-color commands. You
  176. specify the pen and not the actual colour (from 0 to 7 only,
  177. because of restrictions in console.device).
  178.  
  179. o The inverse text & fill colours can be specified with
  180. amiga-set-inverse-text-pen and amiga-set-inverse-fill-pen. The
  181. choices are also pens 0 to 7, or 8 for reverse.
  182.  
  183. o The emacs window can be iconified (onto the workbench) with the
  184. amiga-iconify command. This is bound to shift-middle button on a 3
  185. button mouse, and to C-z (which is normally bound to suspend-emacs,
  186. which doesn't work on the Amiga).
  187.  
  188. To deiconify emacs, double click on the icon.
  189.  
  190. Emacs will continue to answer to ARexx commands while iconified. The
  191. variable amiga-emacs-iconfied is set to 't' while emacs is iconified,
  192. 'nil' the rest of the time.  You can test this, eg to make sure that
  193. emacs is not iconified before reading some user input. If you wish to
  194. deiconify emacs from arexx, simply call (amiga-iconify) again (it is a
  195. toggle).
  196.  
  197. You can specify the position for the icon with (amiga-set-icon-pos x
  198. y), or get the default position with (amiga-set-icon-pos nil nil).
  199.  
  200. If you use the functions described above in s:.emacs, they will take 
  201. effect before emacs's window is opened. This will avoid the nasty
  202. visual effects of the previous version.
  203.  
  204. o You can manipulate the emacs window with amiga-activate-window,
  205. amiga-window-to-front and amiga-window-to-back.
  206.  
  207. o You can get the window and screen size with (amiga-get-window-geometry)
  208. and (amiga-get-screen-geometry). The iconified status is now returned 
  209. by amiga-get-window-geometry instead of the amiga-emacs-iconified variable.
  210.  
  211. d) Menus
  212.  
  213. If you have installed emacs correctly (see the INSTALLATION file), it
  214. will startup with some menus containing some useful basic
  215. functions (the layout was inspired from that of TurboText, another
  216. good editor which has the disadvantage of being more expensive than
  217. emacs ...). Alongside each item is the emacs key sequence which
  218. invokes that function, if any.
  219.  
  220. Using the Menu Help functionality of AmigaDOS 2.04, you can get help
  221. on any menu item by highlighting it with the mouse and pressing the
  222. Help key [This is easier if you're left handed :-)].
  223.  
  224. The menus are not fixed, they are defined by the s:.emacs-menu.el file
  225. (which isn't human-readable). To modify them, edit s:.emacs-menu.menu.
  226. This contains a lisp-like (but quite legible even for lisp-haters)
  227. representation of the menus, which you can modify by adding items or
  228. menus. The format should be obvious (just make sure that closing
  229. brackets correspond to the correct opening ones, emacs always shows
  230. the corresponding '(' when you type a ')'. Also the last bracket
  231. should correspond with the first).
  232.  
  233. When you have finished your changes, type C-c C-c. This will save your
  234. menus, and then generate a .el file from them (this takes several
  235. seconds even on an A3000. Be patient). Then save the resulting file.
  236. To have the new menus take effect immediately, type M-C-x while in the
  237. .el file.
  238.  
  239. Enterprising lisp programmers can customise the menus even more by
  240. modifying the functions amiga-menus-dispatch and/or amiga-menus-help
  241. in lisp/amiga-mouse.el. This code basically receives a (menu-number
  242. menu-item-number) list and must take the appropriate action
  243. (currently, execute the command associated with that particular menu
  244. item). The lack of comments will surely not deter these audacious
  245. pionneers ...
  246.  
  247. e) Command line options
  248.  
  249. Beyond the standard emacs command line options (for which
  250. documentation tends to be rather sketchy, not to say missing), you can
  251. also use:
  252.  
  253. -prealloc <n>: Reserve n bytes of memory for emacs exclusively. This
  254. option *must* be the first on the command line. On the A3000, chip
  255. memory can't be used for emacs (the details are complicated ...), so
  256. you will run out of memory sooner than expected. This option allows
  257. you to reserve some for emacs before it gets eaten by other programs.
  258.  
  259. -fn <font> <size>: Set the font that emacs uses, like the
  260. amiga-set-font command (see section c, on windows). Note that there
  261. must be enough room for 11x4 characters in the standard 640x200
  262. window. So avoid fonts bigger than 40 points ...
  263.  
  264. -nw: Don't use a window, use a serial port. See part 3, Using Emacs
  265. over a serial line.
  266.  
  267. f) ARexx
  268.  
  269. [The ARexx interface has been rewritten for this version by Christian
  270. E. Hopps]
  271.  
  272. Emacs has a full ARexx interface. It can execute scripts and commands
  273. synchronously (waiting for the result) or asynchronously, and has an
  274. ARexx port from which it accepts commands. 
  275.  
  276. To execute a script, use the amiga-arexx-do-command command.  This
  277. asks for the script file name (the default extension is .elx). If you
  278. just want to execute a simple ARexx command, you can prefix those
  279. commands with C-u and specify the string to execute.
  280.  
  281. From lisp, you can use
  282.   (amiga-arexx-send-command "<file>" nil) for a script, and
  283.   (amiga-arexx-send-command "<commands>" t) for direct execution.
  284. (and the same for amiga-arexx-do-command). The result of
  285. amiga-arexx-send-command is an integer that can be passed to
  286. amiga-arexx-wait-command to wait for the completion of the script or
  287. command. It can also be used with amiga-arexx-check-command to check
  288. if the script has finished. For example:
  289.  
  290.   (let ((arexx-id (amiga-send-command "start-fun" nil)))
  291.     ... do something here ...
  292.     ; and wait for arexx script to end
  293.     (amiga-arexx-wait-command arexx-id))
  294.  
  295. amiga-arexx-wait-command returns the result of the script/command.
  296.  
  297. amiga-arexx-do-command-with-results is like amiga-arexx-do-command,
  298. but it returns the result of the script/command.
  299.  
  300. Emacs's ARexx port accepts commands in lisp, and is usually called
  301. EMACS1 (if you run emacs twice simulatenously, the second one will
  302. have EMACS2, and so on). For example (from a shell),
  303.  
  304.   rx "address EMACS1 '(beginning-of-buffer)'"
  305.  
  306. will set point to the beginning of the buffer.
  307.  
  308. ARexx commands are only processed at certain times, so be careful how
  309. you design your applications. These are:
  310.  
  311. o While waiting for commands from the keyboard (ie when emacs is
  312. idle or iconified).
  313. o While processing a synchronous (amiga-arexx-do-command) script or
  314. waiting for a script to terminate with amiga-arexx-wait-command.
  315. o When the amiga-arexx-process function is called.
  316.  
  317. They also affect the user visible state by default (ie calling
  318. beginning-of-buffer as above modifies the user's position). Avoid
  319. sending random commands at random times, or use save-excursion.
  320.  
  321. As usual, all this behaviour can be modified to some extent. Look in
  322. amiga-init.el for details [The source code is the documentation...].
  323.  
  324. There are a few arexx examples in the amiga/contrib directory.
  325.  
  326. g) Workbench support
  327.  
  328. Beyond iconification (see the section on the emacs window), emacs 
  329. supports a number of features for Workbench users:
  330.  
  331. - emacs can be run from the Workbench, by all the usual methods
  332.   (double clicking on the tool, double clicking on a project which
  333.   has temacs as its default tool, etc). All the projects that are
  334.   passed to temacs will be loaded (if they are files), or listed 
  335.   with dired (if they are directories).
  336.  
  337. - icons can be dropped in emacs's window, the corresponding file
  338.   or directory will be loaded or listed.
  339.  
  340. - icons can be created for files that are saved. This is the default
  341.   when emacs is run from the workbench. This is controlled by the
  342.   amiga-create-icons variable: if you always want icons to be
  343.   created, add
  344.  
  345.     (setq amiga-create-icons t)
  346.  
  347.   to s:.emacs, or
  348.  
  349.     (setq amiga-create-icons nil)
  350.  
  351.   if you never want them.
  352.  
  353. h) external processes
  354.  
  355. This version of emacs fully supports synchronous (used to get the
  356. result of ls for dired, for instance) and asynchronous (as in the
  357. 'shell' command) processes. However, it requires Matt Dillon's
  358. 'fifo.device' and 'fifo:' devices to function. See the INSTALLATION
  359. file for details.
  360.  
  361. This allows full support for all emacs functions which call external
  362. programs, providing that said programs exist on the Amiga. The
  363. following work:
  364.   compile (for SAS C v6, with a few occasional problems)
  365.   grep
  366.   shell (but see the discussions below)
  367.   display-time
  368.   dired
  369.   list-directory
  370.   sort-...
  371.  
  372. The compile command sometimes has problems finding file names in the
  373. error messages, and tries to read the current directory instead. If
  374. you are patient, it moves on to the next file.
  375.  
  376. Because of differences between AmigaDOS & Unix, sending signals (eg
  377. interrupt, kill) to processes is not very reliable. The following
  378. points must be kept in mind:
  379.  
  380. - In some unlikely cases, the appropriate process to signal won't be 
  381.   found. 
  382. - The stop-process & continue-process functions don't work.
  383. - interrupt-process & quit-process send a ctrl-c & ctrl-d to the
  384.   process and all its children (probably).
  385. - kill-process also sends a ctrl-c & ctrl-d. It then pretends that
  386.   the process has died.
  387.  
  388. All input sent to a process after an end-of-file is ignored. The process
  389. just sees an endless sequence of end-of-files. This is most visible with
  390. the shell command, where if you send an end-of-file to a program (eg type)
  391. with C-c C-d, the shell will exit. The bug is in fifo.device, not in emacs.
  392.  
  393. The input & output of processes run inside emacs look like interactive
  394. files (which allows, for instance, shells to run correctly). However, this
  395. confuses some programs which expect all interactive files to be Amiga
  396. consoles and causes them to crash. Several versions of ls suffer from this
  397. problem (they run into problems while trying to get the window size).
  398.  
  399. amiga-process-stack-size is the size of the stack for new processes. If it
  400. is 0 (the default), emacs's stack size is used.
  401.  
  402.  
  403. 4. Using emacs over a serial line
  404. ---------------------------------
  405.  
  406. To use emacs over a serial port, you must do:
  407.  
  408.   setenv TERM <terminal type> (eg vt100)
  409.   emacs -nw
  410.  
  411. The setenv line can be put in your User-Startup, so as to avoid typing
  412. it every time.
  413.  
  414. Emacs cannot simply guess how your terminal works from its name, it
  415. needs a description of it. This is found in a termcap file, which
  416. emacs looks for in s:termcap. If you didn't install this file with emacs,
  417. you can do so by typing (in a CLI):
  418.  
  419.   join gnuemacs:etc/termcap.ucb gnuemacs:etc/termcap.amiga as s:termcap
  420.  
  421. [Note: These files only come with the source version]
  422.  
  423. The -nw prevents the use of a window.
  424.  
  425. If you have several serial ports, you can type
  426.  
  427.   emacs -dev ser2.device 2 -nw
  428.  
  429. to use port 2 of device ser2.device. Use of the -dev option still requires the
  430. -nw.
  431.  
  432. These options (-dev & -nw) *must* be specified at the start of the
  433. command line.
  434.  
  435. The descriptions of the Clipboard, the command line options and the
  436. ARexx port in part 2 above also apply to use over a serial port.
  437.  
  438.  
  439. 5. Redumping emacs [This section for expert users only]
  440. -------------------------------------------------------
  441.  
  442. Enterprising users may want to change the lisp files which are loaded
  443. into the Emacs dump file. The procedure for doing this is very similar
  444. to that with the Unix version, except that the amount of pure storage
  445. can be changed without recompiling emacs. This will allow users
  446. without SAS C v6 to still make such changes.
  447.  
  448. The necessary lisp files are only included in the source distribution,
  449. so you will have to get that first. Once that is available, that you
  450. have made all your changes (eg adding some extra files to be dumped),
  451. use the following sequence to redump emacs:
  452.  
  453.   cd gnuemacs:etc
  454.   stack 20000
  455.   /temacs -pure <n> -malloc <m> -nl -batch -l loadup dump
  456.  
  457. The -pure <n> and -malloc <m> options should only be necessary if you
  458. add extra files to be dumped, see below how to choose values for n &
  459. m. The above order for the parameters must be preserved. Specifying
  460. dump without -nl & -batch will have unpredicatable consequences.
  461.  
  462. Once all the files are loaded, a new copy of gnuemacs:etc/EMACS-DATA
  463. will be saved, and all should work correctly. If you get one of the
  464. following messages:
  465.  
  466.   Pure Lisp storage exhausted
  467.  
  468.   Emacs dump: ran out of memory for malloc.
  469.  
  470. read the following description of the -pure & -malloc options:
  471.  
  472. When emacs is dumped, it saves (amongst other things) the copies of
  473. two zones of memory, called the pure storage area and the malloc hunk.
  474. These contain an internal representation of the lisp code, so the more
  475. code you include in a dumped emacs, the bigger these need to be. The
  476. default sizes of these are reasonable sizes for the standard lisp code
  477. which is dumped, but you will probably need to increase them if you
  478. add some more lisp modules. The best way to find the new values for n
  479. (size of pure area) and m (size of the malloc hunk), is to run the
  480. command
  481.  
  482.   cd gnuemacs:etc
  483.   stack 20000
  484.   /temacs -pure 200000 -malloc 200000 -nl -batch -l loadup dump
  485.  
  486. (these sizes should be largely sufficient, but if you still get one of
  487. the two error messages above, increase them). Then run emacs as usual,
  488. and look at the values of the 2 lisp variables
  489.  
  490.      pure-bytes-used
  491. and  amiga-malloc-bytes-used
  492.  
  493. pure-bytes used contains the minimum value for n, and
  494. amiga-malloc-bytes-used the minimum value for m. Add 1000 to these for
  495. luck to get values for n and m, and redump emacs using these.
  496.  
  497. For those who are into modifying the C source, the default values are
  498. 130000 for n (see DEF_PURESIZE in s-amiga.h) and 92000 for m (see
  499. MALLOC_HUNK_SIZE in amiga.h).
  500.  
  501. 6. Source
  502. ---------
  503.  
  504. Source for emacs and all the programs included with it should be
  505. obtainable from the same place as this file. If not, please send me
  506. mail (if you are on the Internet) and I will provide the missing
  507. pieces. Specifically, there should be:
  508.  
  509. - The emacs sources
  510. - Sources for the 'unix library' needed to compile emacs
  511. - Source for the programs in the c directory (ls, sort, rmdir, grep).
  512. This consists of the GNU fileutils, textutils and grep packages.
  513.  
  514. Distributing the binary without these packages is a violation of
  515. the GNU General Public License (see the file COPYRIGHT in the etc
  516. directory) under which emacs is distributed.
  517.  
  518. 7. Thanks & Problems
  519. --------------------
  520.  
  521. I would like to thank the following people for their help while porting
  522. emacs:
  523.  
  524. - Mark D. Henning for the early port of emacs. He's the person who got
  525. emacs working on the Amiga ...
  526. - Christian E. Hopps for enhancements to the screen display code, a
  527. rewrite of the AREXX code, testing and useful suggestions.
  528. - All the beta testers and people who contributed useful utilities (see
  529. the amiga/contrib directory):
  530.   Jean-Marc Vandel
  531.   Philippe Morel
  532.   Jukka Partanen
  533.   Michael Witbrock
  534.   Tero Manninen
  535.   Alan Bair
  536.   Hugh D. Gamble
  537.   Tapio Heiskanen
  538.   Teddy Wang
  539.   Richard McGowen
  540.   Keith Hanlan
  541.   Carsten Heyl
  542.   Anders Lindgren
  543.   Michel Schinz
  544.   Hans-Joachim Widmaier
  545.   Michael Kaiser
  546.  
  547. Please send any bug reports, enhancement requests, etc to:
  548.  
  549. Post:                E-mail:
  550. David Gay            dgay@di.epfl.ch
  551. 19 Chemin de la Source
  552. CH-1296 Coppet
  553. Vaud
  554. Switzerland
  555.  
  556. David Gay
  557. dgay@di.epfl.ch
  558.